﻿

Option Explicit On
Option Strict Off

'*******************************************************************
' Program: Data Center Visio Rack Tool
' Author: Albert E Edlund
' Date:
'
' Purpose:
' ItemsSource="{Binding Data, ElementName=source}" 
' CurrentItem="{Binding SelectedItem, ElementName=_dataGrid}"
' http://www.silverlight.net/learn/videos/all/net-ria-services-intro/
'
'*******************************************************************

Imports System
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Controls.DomainDataSource
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports System.Windows.Navigation '
Imports System.Windows.Browser
Imports System.Windows.Data
Imports System.Windows.Controls.DataForm
Imports System.IO
Imports System.ServiceModel.DomainServices.Client
Imports Microsoft.VisualBasic
Imports System.Diagnostics.CodeAnalysis


Imports DC_RackSLDE.Web



Partial Public Class addtblAttrProcessor
    Inherits ChildWindow

#Region " Properties and declarations "

    Private m_AttrProcessor As DC_RackSLDE.tblAttrProcessor
    Public Property newAttrProcessor As DC_RackSLDE.tblAttrProcessor
        Get
            Return m_AttrProcessor
        End Get
        Set(ByVal value As DC_RackSLDE.tblAttrProcessor)
            m_AttrProcessor = value
        End Set
    End Property

#End Region


    Public Sub New()

        InitializeComponent()
        newAttrProcessor = New DC_RackSLDE.tblAttrProcessor
        _dataForm.IsReadOnly = False
        _dataForm.CurrentItem = newAttrProcessor
        _dataForm.BeginEdit()

    End Sub

    Private Sub OKButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles OKButton.Click

        Try
            Dim selectedAttr As IEditableObject = _dataForm.CurrentItem
            selectedAttr.EndEdit()
            _dataForm.CommitEdit()
            Me.DialogResult = True

        Catch ex As Exception

            ErrorWindow.CreateNew(ex, StackTracePolicy.Always)


        End Try

    End Sub

    Private Sub CancelButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles CancelButton.Click
        newAttrProcessor = Nothing
        _dataForm.CancelEdit()
        Me.DialogResult = False
    End Sub

End Class
